Hi! I used this code, just now to read the battery voltage from GPIO4.
Do not to declare Input as INPUT mode
top of the sketch:
#define analogPin 4 //the built in battery voltage test point
float val = 1.23; //a test number to check if I'm getting a real value
in "setup"
Serial.begin(115200); // be sure to set USB CDC On Boot: "Enabled"
The entire test loop:
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val/1000); // testing value
delay(1000);
}
That's it...I'm getting 2.94VDC.
The ESP32 has terrible ADC capabilities, so this is it!
I also have a LilyGO T-Display S3 support page on GitHub here:
https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples
lots of goodies
-Terry